package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface DeptMapper {


    void insert(Dept dept);

    // 更新部门信息
    void update(Dept dept);

    // 根据部门ID删除部门信息
    @Delete("delete from dept where id=#{id}")
    void deleteById(Integer id);

    // 根据部门名称查询部门信息
    @Select("select * from dept where id=#{id}")
    Dept selectById(Integer id);

    // 查询所有部门信息
    @Select("select * from dept order by update_time desc ")
    List<Dept> selectAll();
}
